package cn.gailvlun.gll.presentation.apartment.adapter;

import android.content.Context;

import com.github.markzhai.recyclerview.MultiTypeAdapter;

import cn.gailvlun.gll.R;
import cn.gailvlun.gll.net.apartment.room.Room;



public class ApartmentAdapter extends MultiTypeAdapter {

    public enum Type {
        BANNER,
        SKILL,
        TITLE,
        RECOMMEND,
        EMPTY
    }

    public ApartmentAdapter(Context context) {
        super(context);

        addViewTypeToLayoutMap(Type.BANNER.ordinal(), R.layout.item_apartment_banner);
        addViewTypeToLayoutMap(Type.SKILL.ordinal(), R.layout.item_apartment_skill);
        addViewTypeToLayoutMap(Type.TITLE.ordinal(), R.layout.item_apartment_title);
        addViewTypeToLayoutMap(Type.RECOMMEND.ordinal(), R.layout.item_apartment_recommend);
        addViewTypeToLayoutMap(Type.EMPTY.ordinal(), R.layout.item_apartment_empty);
    }

    public Room getLastRoom() {
        for (int i = mCollection.size() - 1; i >= 0; i--) {
            if (mCollection.get(i) instanceof Room) {
                return (Room) mCollection.get(i);
            }
        }
        return null;
    }
}
